package leetcode.code1237;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

class Solution {

	interface CustomFunction {
		// Returns f(x, y) for any given positive integers x and y.
		// Note that f(x, y) is increasing with respect to both x and y.
		// i.e. f(x, y) < f(x + 1, y), f(x, y) < f(x, y + 1)
		public int f(int x, int y);
	};

	public List<List<Integer>> findSolution(CustomFunction customfunction, int z) {
		List<List<Integer>> ans = new ArrayList<>();
		for (int i = 1; i < 1001; i++) {
			for (int j = 1; j < 1001; j++) {
				if (customfunction.f(i, j) == z) {
					ans.add(Arrays.asList(new Integer[] { i, j }));
				}
			}
		}
		return ans;
	}
}